home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / editors / emacs / xemacs / xemacs-1.006 / xemacs-1 / lib / xemacs-19.13 / info / lispref.info-22 < prev    next >
Encoding:
GNU Info File  |  1995-09-01  |  50.2 KB  |  1,197 lines

  1. This is Info file ../../info/lispref.info, produced by Makeinfo-1.63
  2. from the input file lispref.texi.
  3.  
  4.    Edition History:
  5.  
  6.    GNU Emacs Lisp Reference Manual Second Edition (v2.01), May 1993 GNU
  7. Emacs Lisp Reference Manual Further Revised (v2.02), August 1993 Lucid
  8. Emacs Lisp Reference Manual (for 19.10) First Edition, March 1994
  9. XEmacs Lisp Programmer's Manual (for 19.12) Second Edition, April 1995
  10. GNU Emacs Lisp Reference Manual v2.4, June 1995 XEmacs Lisp
  11. Programmer's Manual (for 19.13) Third Edition, July 1995
  12.  
  13.    Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995 Free Software
  14. Foundation, Inc.  Copyright (C) 1994, 1995 Sun Microsystems, Inc.
  15. Copyright (C) 1995 Amdahl Corporation.  Copyright (C) 1995 Ben Wing.
  16.  
  17.    Permission is granted to make and distribute verbatim copies of this
  18. manual provided the copyright notice and this permission notice are
  19. preserved on all copies.
  20.  
  21.    Permission is granted to copy and distribute modified versions of
  22. this manual under the conditions for verbatim copying, provided that the
  23. entire resulting derived work is distributed under the terms of a
  24. permission notice identical to this one.
  25.  
  26.    Permission is granted to copy and distribute translations of this
  27. manual into another language, under the above conditions for modified
  28. versions, except that this permission notice may be stated in a
  29. translation approved by the Foundation.
  30.  
  31.    Permission is granted to copy and distribute modified versions of
  32. this manual under the conditions for verbatim copying, provided also
  33. that the section entitled "GNU General Public License" is included
  34. exactly as in the original, and provided that the entire resulting
  35. derived work is distributed under the terms of a permission notice
  36. identical to this one.
  37.  
  38.    Permission is granted to copy and distribute translations of this
  39. manual into another language, under the above conditions for modified
  40. versions, except that the section entitled "GNU General Public License"
  41. may be included in a translation approved by the Free Software
  42. Foundation instead of in the original English.
  43.  
  44. 
  45. File: lispref.info,  Node: Current Buffer,  Next: Buffer Names,  Prev: Buffer Basics,  Up: Buffers
  46.  
  47. The Current Buffer
  48. ==================
  49.  
  50.    There are, in general, many buffers in an Emacs session.  At any
  51. time, one of them is designated as the "current buffer".  This is the
  52. buffer in which most editing takes place, because most of the primitives
  53. for examining or changing text in a buffer operate implicitly on the
  54. current buffer (*note Text::.).  Normally the buffer that is displayed
  55. on the screen in the selected window is the current buffer, but this is
  56. not always so: a Lisp program can designate any buffer as current
  57. temporarily in order to operate on its contents, without changing what
  58. is displayed on the screen.
  59.  
  60.    The way to designate a current buffer in a Lisp program is by calling
  61. `set-buffer'.  The specified buffer remains current until a new one is
  62. designated.
  63.  
  64.    When an editing command returns to the editor command loop, the
  65. command loop designates the buffer displayed in the selected window as
  66. current, to prevent confusion: the buffer that the cursor is in when
  67. Emacs reads a command is the buffer that the command will apply to.
  68. (*Note Command Loop::.)  Therefore, `set-buffer' is not the way to
  69. switch visibly to a different buffer so that the user can edit it.  For
  70. this, you must use the functions described in *Note Displaying
  71. Buffers::.
  72.  
  73.    However, Lisp functions that change to a different current buffer
  74. should not depend on the command loop to set it back afterwards.
  75. Editing commands written in Emacs Lisp can be called from other programs
  76. as well as from the command loop.  It is convenient for the caller if
  77. the subroutine does not change which buffer is current (unless, of
  78. course, that is the subroutine's purpose).  Therefore, you should
  79. normally use `set-buffer' within a `save-excursion' that will restore
  80. the current buffer when your function is done (*note Excursions::.).
  81. Here is an example, the code for the command `append-to-buffer' (with
  82. the documentation string abridged):
  83.  
  84.      (defun append-to-buffer (buffer start end)
  85.        "Append to specified buffer the text of the region.
  86.      ..."
  87.        (interactive "BAppend to buffer: \nr")
  88.        (let ((oldbuf (current-buffer)))
  89.          (save-excursion
  90.            (set-buffer (get-buffer-create buffer))
  91.            (insert-buffer-substring oldbuf start end))))
  92.  
  93. This function binds a local variable to the current buffer, and then
  94. `save-excursion' records the values of point, the mark, and the
  95. original buffer.  Next, `set-buffer' makes another buffer current.
  96. Finally, `insert-buffer-substring' copies the string from the original
  97. current buffer to the new current buffer.
  98.  
  99.    If the buffer appended to happens to be displayed in some window,
  100. the next redisplay will show how its text has changed.  Otherwise, you
  101. will not see the change immediately on the screen.  The buffer becomes
  102. current temporarily during the execution of the command, but this does
  103. not cause it to be displayed.
  104.  
  105.    If you make local bindings (with `let' or function arguments) for a
  106. variable that may also have buffer-local bindings, make sure that the
  107. same buffer is current at the beginning and at the end of the local
  108. binding's scope.  Otherwise you might bind it in one buffer and unbind
  109. it in another!  There are two ways to do this.  In simple cases, you may
  110. see that nothing ever changes the current buffer within the scope of the
  111. binding.  Otherwise, use `save-excursion' to make sure that the buffer
  112. current at the beginning is current again whenever the variable is
  113. unbound.
  114.  
  115.    It is not reliable to change the current buffer back with
  116. `set-buffer', because that won't do the job if a quit happens while the
  117. wrong buffer is current.  Here is what *not* to do:
  118.  
  119.      (let (buffer-read-only
  120.            (obuf (current-buffer)))
  121.        (set-buffer ...)
  122.        ...
  123.        (set-buffer obuf))
  124.  
  125. Using `save-excursion', as shown below, handles quitting, errors, and
  126. `throw', as well as ordinary evaluation.
  127.  
  128.      (let (buffer-read-only)
  129.        (save-excursion
  130.          (set-buffer ...)
  131.          ...))
  132.  
  133.  - Function: current-buffer
  134.      This function returns the current buffer.
  135.  
  136.           (current-buffer)
  137.                => #<buffer buffers.texi>
  138.  
  139.  - Function: set-buffer BUFFER-OR-NAME
  140.      This function makes BUFFER-OR-NAME the current buffer.  It does
  141.      not display the buffer in the currently selected window or in any
  142.      other window, so the user cannot necessarily see the buffer.  But
  143.      Lisp programs can in any case work on it.
  144.  
  145.      This function returns the buffer identified by BUFFER-OR-NAME.  An
  146.      error is signaled if BUFFER-OR-NAME does not identify an existing
  147.      buffer.
  148.  
  149. 
  150. File: lispref.info,  Node: Buffer Names,  Next: Buffer File Name,  Prev: Current Buffer,  Up: Buffers
  151.  
  152. Buffer Names
  153. ============
  154.  
  155.    Each buffer has a unique name, which is a string.  Many of the
  156. functions that work on buffers accept either a buffer or a buffer name
  157. as an argument.  Any argument called BUFFER-OR-NAME is of this sort,
  158. and an error is signaled if it is neither a string nor a buffer.  Any
  159. argument called BUFFER must be an actual buffer object, not a name.
  160.  
  161.    Buffers that are ephemeral and generally uninteresting to the user
  162. have names starting with a space, so that the `list-buffers' and
  163. `buffer-menu' commands don't mention them.  A name starting with space
  164. also initially disables recording undo information; see *Note Undo::.
  165.  
  166.  - Function: buffer-name &optional BUFFER
  167.      This function returns the name of BUFFER as a string.  If BUFFER
  168.      is not supplied, it defaults to the current buffer.
  169.  
  170.      If `buffer-name' returns `nil', it means that BUFFER has been
  171.      killed.  *Note Killing Buffers::.
  172.  
  173.           (buffer-name)
  174.                => "buffers.texi"
  175.           
  176.           (setq foo (get-buffer "temp"))
  177.                => #<buffer temp>
  178.           (kill-buffer foo)
  179.                => nil
  180.           (buffer-name foo)
  181.                => nil
  182.           foo
  183.                => #<killed buffer>
  184.  
  185.  - Command: rename-buffer NEWNAME &optional UNIQUE
  186.      This function renames the current buffer to NEWNAME.  An error is
  187.      signaled if NEWNAME is not a string, or if there is already a
  188.      buffer with that name.  The function returns `nil'.
  189.  
  190.      Ordinarily, `rename-buffer' signals an error if NEWNAME is already
  191.      in use.  However, if UNIQUE is non-`nil', it modifies NEWNAME to
  192.      make a name that is not in use.  Interactively, you can make
  193.      UNIQUE non-`nil' with a numeric prefix argument.
  194.  
  195.      One application of this command is to rename the `*shell*' buffer
  196.      to some other name, thus making it possible to create a second
  197.      shell buffer under the name `*shell*'.
  198.  
  199.  - Function: get-buffer BUFFER-OR-NAME
  200.      This function returns the buffer specified by BUFFER-OR-NAME.  If
  201.      BUFFER-OR-NAME is a string and there is no buffer with that name,
  202.      the value is `nil'.  If BUFFER-OR-NAME is a buffer, it is returned
  203.      as given.  (That is not very useful, so the argument is usually a
  204.      name.)  For example:
  205.  
  206.           (setq b (get-buffer "lewis"))
  207.                => #<buffer lewis>
  208.           (get-buffer b)
  209.                => #<buffer lewis>
  210.           (get-buffer "Frazzle-nots")
  211.                => nil
  212.  
  213.      See also the function `get-buffer-create' in *Note Creating
  214.      Buffers::.
  215.  
  216.  - Function: generate-new-buffer-name STARTING-NAME &optional IGNORE
  217.      This function returns a name that would be unique for a new
  218.      buffer--but does not create the buffer.  It starts with
  219.      STARTING-NAME, and produces a name not currently in use for any
  220.      buffer by appending a number inside of `<...>'.
  221.  
  222.      If IGNORE is given, it specifies a name that is okay to use (if it
  223.      is in the sequence to be tried), even if a buffer with that name
  224.      exists.
  225.  
  226.      See the related function `generate-new-buffer' in *Note Creating
  227.      Buffers::.
  228.  
  229. 
  230. File: lispref.info,  Node: Buffer File Name,  Next: Buffer Modification,  Prev: Buffer Names,  Up: Buffers
  231.  
  232. Buffer File Name
  233. ================
  234.  
  235.    The "buffer file name" is the name of the file that is visited in
  236. that buffer.  When a buffer is not visiting a file, its buffer file name
  237. is `nil'.  Most of the time, the buffer name is the same as the
  238. nondirectory part of the buffer file name, but the buffer file name and
  239. the buffer name are distinct and can be set independently.  *Note
  240. Visiting Files::.
  241.  
  242.  - Function: buffer-file-name &optional BUFFER
  243.      This function returns the absolute file name of the file that
  244.      BUFFER is visiting.  If BUFFER is not visiting any file,
  245.      `buffer-file-name' returns `nil'.  If BUFFER is not supplied, it
  246.      defaults to the current buffer.
  247.  
  248.           (buffer-file-name (other-buffer))
  249.                => "/usr/user/lewis/manual/files.texi"
  250.  
  251.  - Variable: buffer-file-name
  252.      This buffer-local variable contains the name of the file being
  253.      visited in the current buffer, or `nil' if it is not visiting a
  254.      file.  It is a permanent local, unaffected by
  255.      `kill-local-variables'.
  256.  
  257.           buffer-file-name
  258.                => "/usr/user/lewis/manual/buffers.texi"
  259.  
  260.      It is risky to change this variable's value without doing various
  261.      other things.  See the definition of `set-visited-file-name' in
  262.      `files.el'; some of the things done there, such as changing the
  263.      buffer name, are not strictly necessary, but others are essential
  264.      to avoid confusing XEmacs.
  265.  
  266.  - Variable: buffer-file-truename
  267.      This buffer-local variable holds the truename of the file visited
  268.      in the current buffer, or `nil' if no file is visited.  It is a
  269.      permanent local, unaffected by `kill-local-variables'.  *Note
  270.      Truenames::.
  271.  
  272.  - Variable: buffer-file-number
  273.      This buffer-local variable holds the file number and directory
  274.      device number of the file visited in the current buffer, or `nil'
  275.      if no file or a nonexistent file is visited.  It is a permanent
  276.      local, unaffected by `kill-local-variables'.  *Note Truenames::.
  277.  
  278.      The value is normally a list of the form `(FILENUM DEVNUM)'.  This
  279.      pair of numbers uniquely identifies the file among all files
  280.      accessible on the system.  See the function `file-attributes', in
  281.      *Note File Attributes::, for more information about them.
  282.  
  283.  - Function: get-file-buffer FILENAME
  284.      This function returns the buffer visiting file FILENAME.  If there
  285.      is no such buffer, it returns `nil'.  The argument FILENAME, which
  286.      must be a string, is expanded (*note File Name Expansion::.), then
  287.      compared against the visited file names of all live buffers.
  288.  
  289.           (get-file-buffer "buffers.texi")
  290.               => #<buffer buffers.texi>
  291.  
  292.      In unusual circumstances, there can be more than one buffer
  293.      visiting the same file name.  In such cases, this function returns
  294.      the first such buffer in the buffer list.
  295.  
  296.  - Command: set-visited-file-name FILENAME
  297.      If FILENAME is a non-empty string, this function changes the name
  298.      of the file visited in current buffer to FILENAME.  (If the buffer
  299.      had no visited file, this gives it one.)  The *next time* the
  300.      buffer is saved it will go in the newly-specified file.  This
  301.      command marks the buffer as modified, since it does not (as far as
  302.      XEmacs knows) match the contents of FILENAME, even if it matched
  303.      the former visited file.
  304.  
  305.      If FILENAME is `nil' or the empty string, that stands for "no
  306.      visited file".  In this case, `set-visited-file-name' marks the
  307.      buffer as having no visited file.
  308.  
  309.      When the function `set-visited-file-name' is called interactively,
  310.      it prompts for FILENAME in the minibuffer.
  311.  
  312.      See also `clear-visited-file-modtime' and
  313.      `verify-visited-file-modtime' in *Note Buffer Modification::.
  314.  
  315.  - Variable: list-buffers-directory
  316.      This buffer-local variable records a string to display in a buffer
  317.      listing in place of the visited file name, for buffers that don't
  318.      have a visited file name.  Dired buffers use this variable.
  319.  
  320. 
  321. File: lispref.info,  Node: Buffer Modification,  Next: Modification Time,  Prev: Buffer File Name,  Up: Buffers
  322.  
  323. Buffer Modification
  324. ===================
  325.  
  326.    XEmacs keeps a flag called the "modified flag" for each buffer, to
  327. record whether you have changed the text of the buffer.  This flag is
  328. set to `t' whenever you alter the contents of the buffer, and cleared
  329. to `nil' when you save it.  Thus, the flag shows whether there are
  330. unsaved changes.  The flag value is normally shown in the modeline
  331. (*note Modeline Variables::.), and controls saving (*note Saving
  332. Buffers::.) and auto-saving (*note Auto-Saving::.).
  333.  
  334.    Some Lisp programs set the flag explicitly.  For example, the
  335. function `set-visited-file-name' sets the flag to `t', because the text
  336. does not match the newly-visited file, even if it is unchanged from the
  337. file formerly visited.
  338.  
  339.    The functions that modify the contents of buffers are described in
  340. *Note Text::.
  341.  
  342.  - Function: buffer-modified-p &optional BUFFER
  343.      This function returns `t' if the buffer BUFFER has been modified
  344.      since it was last read in from a file or saved, or `nil'
  345.      otherwise.  If BUFFER is not supplied, the current buffer is
  346.      tested.
  347.  
  348.  - Function: set-buffer-modified-p FLAG
  349.      This function marks the current buffer as modified if FLAG is
  350.      non-`nil', or as unmodified if the flag is `nil'.
  351.  
  352.      Another effect of calling this function is to cause unconditional
  353.      redisplay of the modeline for the current buffer.  In fact, the
  354.      function `redraw-modeline' works by doing this:
  355.  
  356.           (set-buffer-modified-p (buffer-modified-p))
  357.  
  358.  - Command: not-modified &optional ARG
  359.      This command marks the current buffer as unmodified, and not
  360.      needing to be saved. (If ARG is non-`nil', the buffer is instead
  361.      marked as modified.) Don't use this function in programs, since it
  362.      prints a message in the echo area; use `set-buffer-modified-p'
  363.      (above) instead.
  364.  
  365.  - Function: buffer-modified-tick &optional BUFFER
  366.      This function returns BUFFER`s modification-count.  This is a
  367.      counter that increments every time the buffer is modified.  If
  368.      BUFFER is `nil' (or omitted), the current buffer is used.
  369.  
  370. 
  371. File: lispref.info,  Node: Modification Time,  Next: Read Only Buffers,  Prev: Buffer Modification,  Up: Buffers
  372.  
  373. Comparison of Modification Time
  374. ===============================
  375.  
  376.    Suppose that you visit a file and make changes in its buffer, and
  377. meanwhile the file itself is changed on disk.  At this point, saving the
  378. buffer would overwrite the changes in the file.  Occasionally this may
  379. be what you want, but usually it would lose valuable information.
  380. XEmacs therefore checks the file's modification time using the functions
  381. described below before saving the file.
  382.  
  383.  - Function: verify-visited-file-modtime BUFFER
  384.      This function compares what BUFFER has recorded for the
  385.      modification time of its visited file against the actual
  386.      modification time of the file as recorded by the operating system.
  387.      The two should be the same unless some other process has written
  388.      the file since XEmacs visited or saved it.
  389.  
  390.      The function returns `t' if the last actual modification time and
  391.      XEmacs's recorded modification time are the same, `nil' otherwise.
  392.  
  393.  - Function: clear-visited-file-modtime
  394.      This function clears out the record of the last modification time
  395.      of the file being visited by the current buffer.  As a result, the
  396.      next attempt to save this buffer will not complain of a
  397.      discrepancy in file modification times.
  398.  
  399.      This function is called in `set-visited-file-name' and other
  400.      exceptional places where the usual test to avoid overwriting a
  401.      changed file should not be done.
  402.  
  403.  - Function: visited-file-modtime
  404.      This function returns the buffer's recorded last file modification
  405.      time, as a list of the form `(HIGH . LOW)'.  (This is the same
  406.      format that `file-attributes' uses to return time values; see
  407.      *Note File Attributes::.)
  408.  
  409.  - Function: set-visited-file-modtime &optional TIME
  410.      This function updates the buffer's record of the last modification
  411.      time of the visited file, to the value specified by TIME if TIME
  412.      is not `nil', and otherwise to the last modification time of the
  413.      visited file.
  414.  
  415.      If TIME is not `nil', it should have the form `(HIGH . LOW)' or
  416.      `(HIGH LOW)', in either case containing two integers, each of
  417.      which holds 16 bits of the time.
  418.  
  419.      This function is useful if the buffer was not read from the file
  420.      normally, or if the file itself has been changed for some known
  421.      benign reason.
  422.  
  423.  - Function: ask-user-about-supersession-threat FILENAME
  424.      This function is used to ask a user how to proceed after an
  425.      attempt to modify an obsolete buffer visiting file FILENAME.  An
  426.      "obsolete buffer" is an unmodified buffer for which the associated
  427.      file on disk is newer than the last save-time of the buffer.  This
  428.      means some other program has probably altered the file.
  429.  
  430.      Depending on the user's answer, the function may return normally,
  431.      in which case the modification of the buffer proceeds, or it may
  432.      signal a `file-supersession' error with data `(FILENAME)', in which
  433.      case the proposed buffer modification is not allowed.
  434.  
  435.      This function is called automatically by XEmacs on the proper
  436.      occasions.  It exists so you can customize XEmacs by redefining it.
  437.      See the file `userlock.el' for the standard definition.
  438.  
  439.      See also the file locking mechanism in *Note File Locks::.
  440.  
  441. 
  442. File: lispref.info,  Node: Read Only Buffers,  Next: The Buffer List,  Prev: Modification Time,  Up: Buffers
  443.  
  444. Read-Only Buffers
  445. =================
  446.  
  447.    If a buffer is "read-only", then you cannot change its contents,
  448. although you may change your view of the contents by scrolling and
  449. narrowing.
  450.  
  451.    Read-only buffers are used in two kinds of situations:
  452.  
  453.    * A buffer visiting a write-protected file is normally read-only.
  454.  
  455.      Here, the purpose is to show the user that editing the buffer with
  456.      the aim of saving it in the file may be futile or undesirable.
  457.      The user who wants to change the buffer text despite this can do
  458.      so after clearing the read-only flag with `C-x C-q'.
  459.  
  460.    * Modes such as Dired and Rmail make buffers read-only when altering
  461.      the contents with the usual editing commands is probably a mistake.
  462.  
  463.      The special commands of these modes bind `buffer-read-only' to
  464.      `nil' (with `let') or bind `inhibit-read-only' to `t' around the
  465.      places where they change the text.
  466.  
  467.  - Variable: buffer-read-only
  468.      This buffer-local variable specifies whether the buffer is
  469.      read-only.  The buffer is read-only if this variable is non-`nil'.
  470.  
  471.  - Variable: inhibit-read-only
  472.      If this variable is non-`nil', then read-only buffers and read-only
  473.      characters may be modified.  Read-only characters in a buffer are
  474.      those that have non-`nil' `read-only' properties (either text
  475.      properties or extent properties).  *Note Extent Properties::, for
  476.      more information about text properties and extent properties.
  477.  
  478.      If `inhibit-read-only' is `t', all `read-only' character
  479.      properties have no effect.  If `inhibit-read-only' is a list, then
  480.      `read-only' character properties have no effect if they are members
  481.      of the list (comparison is done with `eq').
  482.  
  483.  - Command: toggle-read-only
  484.      This command changes whether the current buffer is read-only.  It
  485.      is intended for interactive use; don't use it in programs.  At any
  486.      given point in a program, you should know whether you want the
  487.      read-only flag on or off; so you can set `buffer-read-only'
  488.      explicitly to the proper value, `t' or `nil'.
  489.  
  490.  - Function: barf-if-buffer-read-only
  491.      This function signals a `buffer-read-only' error if the current
  492.      buffer is read-only.  *Note Interactive Call::, for another way to
  493.      signal an error if the current buffer is read-only.
  494.  
  495. 
  496. File: lispref.info,  Node: The Buffer List,  Next: Creating Buffers,  Prev: Read Only Buffers,  Up: Buffers
  497.  
  498. The Buffer List
  499. ===============
  500.  
  501.    The "buffer list" is a list of all live buffers.  Creating a buffer
  502. adds it to this list, and killing a buffer deletes it.  The order of
  503. the buffers in the list is based primarily on how recently each buffer
  504. has been displayed in the selected window.  Buffers move to the front
  505. of the list when they are selected and to the end when they are buried.
  506. Several functions, notably `other-buffer', use this ordering.  A
  507. buffer list displayed for the user also follows this order.
  508.  
  509.    Every frame has its own order for the buffer list.  Switching to a
  510. new buffer inside of a particular frame changes the buffer list order
  511. for that frame, but does not affect the buffer list order of any other
  512. frames.  In addition, there is a global, non-frame buffer list order
  513. that is independent of the buffer list orders for any particular frame.
  514.  
  515.    Note that the different buffer lists all contain the same elements.
  516. It is only the order of those elements that is different.
  517.  
  518.  - Function: buffer-list &optional FRAME
  519.      This function returns a list of all buffers, including those whose
  520.      names begin with a space.  The elements are actual buffers, not
  521.      their names.  The order of the list is specific to FRAME, which
  522.      defaults to the current frame.  If FRAME is `t', the global,
  523.      non-frame ordering is returned instead.
  524.  
  525.           (buffer-list)
  526.                => (#<buffer buffers.texi>
  527.                    #<buffer  *Minibuf-1*> #<buffer buffer.c>
  528.                    #<buffer *Help*> #<buffer TAGS>)
  529.           
  530.           ;; Note that the name of the minibuffer
  531.           ;;   begins with a space!
  532.           (mapcar (function buffer-name) (buffer-list))
  533.               => ("buffers.texi" " *Minibuf-1*"
  534.                   "buffer.c" "*Help*" "TAGS")
  535.  
  536.      Buffers appear earlier in the list if they were current more
  537.      recently.
  538.  
  539.      This list is a copy of a list used inside XEmacs; modifying it has
  540.      no effect on the buffers.
  541.  
  542.  - Function: other-buffer &optional BUFFER-OR-NAME FRAME
  543.      This function returns the first buffer in the buffer list other
  544.      than BUFFER-OR-NAME, in FRAME's ordering for the buffer list.
  545.      (FRAME defaults to the current frame.  If FRAME is `t', then the
  546.      global, non-frame ordering is used.) Usually this is the buffer
  547.      most recently shown in the selected window, aside from
  548.      BUFFER-OR-NAME.  Buffers are moved to the front of the list when
  549.      they are selected and to the end when they are buried.  Buffers
  550.      whose names start with a space are not considered.
  551.  
  552.      If BUFFER-OR-NAME is not supplied (or if it is not a buffer), then
  553.      `other-buffer' returns the first buffer on the buffer list that is
  554.      not visible in any window in a visible frame.
  555.  
  556.      If the selected frame has a non-`nil' `buffer-predicate'
  557.      parameter, then `other-buffer' uses that predicate to decide which
  558.      buffers to consider.  It calls the predicate once for each buffer,
  559.      and if the value is `nil', that buffer is ignored.  *Note X Frame
  560.      Parameters::.
  561.  
  562.      Note that the FRAME argument has a different interpretation in FSF
  563.      Emacs 19.
  564.  
  565.      If no suitable buffer exists, the buffer `*scratch*' is returned
  566.      (and created, if necessary).
  567.  
  568.  - Command: list-buffers &optional FILES-ONLY
  569.      This function displays a listing of the names of existing buffers.
  570.      It clears the buffer `*Buffer List*', then inserts the listing
  571.      into that buffer and displays it in a window.  `list-buffers' is
  572.      intended for interactive use, and is described fully in `The XEmacs
  573.      Reference Manual'.  It returns `nil'.
  574.  
  575.  - Command: bury-buffer &optional BUFFER-OR-NAME
  576.      This function puts BUFFER-OR-NAME at the end of the buffer list
  577.      without changing the order of any of the other buffers on the list.
  578.      This buffer therefore becomes the least desirable candidate for
  579.      `other-buffer' to return.
  580.  
  581.      If BUFFER-OR-NAME is `nil' or omitted, this means to bury the
  582.      current buffer.  In addition, if the buffer is displayed in the
  583.      selected window, this switches to some other buffer (obtained using
  584.      `other-buffer') in the selected window.  But if the buffer is
  585.      displayed in some other window, it remains displayed there.
  586.  
  587.      If you wish to replace a buffer in all the windows that display
  588.      it, use `replace-buffer-in-windows'.  *Note Buffers and Windows::.
  589.  
  590. 
  591. File: lispref.info,  Node: Creating Buffers,  Next: Killing Buffers,  Prev: The Buffer List,  Up: Buffers
  592.  
  593. Creating Buffers
  594. ================
  595.  
  596.    This section describes the two primitives for creating buffers.
  597. `get-buffer-create' creates a buffer if it finds no existing buffer
  598. with the specified name; `generate-new-buffer' always creates a new
  599. buffer and gives it a unique name.
  600.  
  601.    Other functions you can use to create buffers include
  602. `with-output-to-temp-buffer' (*note Temporary Displays::.) and
  603. `create-file-buffer' (*note Visiting Files::.).  Starting a subprocess
  604. can also create a buffer (*note Processes::.).
  605.  
  606.  - Function: get-buffer-create NAME
  607.      This function returns a buffer named NAME.  It returns an existing
  608.      buffer with that name, if one exists; otherwise, it creates a new
  609.      buffer.  The buffer does not become the current buffer--this
  610.      function does not change which buffer is current.
  611.  
  612.      An error is signaled if NAME is not a string.
  613.  
  614.           (get-buffer-create "foo")
  615.                => #<buffer foo>
  616.  
  617.      The major mode for the new buffer is set to Fundamental mode.  The
  618.      variable `default-major-mode' is handled at a higher level.  *Note
  619.      Auto Major Mode::.
  620.  
  621.  - Function: generate-new-buffer NAME
  622.      This function returns a newly created, empty buffer, but does not
  623.      make it current.  If there is no buffer named NAME, then that is
  624.      the name of the new buffer.  If that name is in use, this function
  625.      adds suffixes of the form `<N>' to NAME, where N is an integer.
  626.      It tries successive integers starting with 2 until it finds an
  627.      available name.
  628.  
  629.      An error is signaled if NAME is not a string.
  630.  
  631.           (generate-new-buffer "bar")
  632.                => #<buffer bar>
  633.           (generate-new-buffer "bar")
  634.                => #<buffer bar<2>>
  635.           (generate-new-buffer "bar")
  636.                => #<buffer bar<3>>
  637.  
  638.      The major mode for the new buffer is set to Fundamental mode.  The
  639.      variable `default-major-mode' is handled at a higher level.  *Note
  640.      Auto Major Mode::.
  641.  
  642.      See the related function `generate-new-buffer-name' in *Note
  643.      Buffer Names::.
  644.  
  645. 
  646. File: lispref.info,  Node: Killing Buffers,  Next: Indirect Buffers,  Prev: Creating Buffers,  Up: Buffers
  647.  
  648. Killing Buffers
  649. ===============
  650.  
  651.    "Killing a buffer" makes its name unknown to XEmacs and makes its
  652. text space available for other use.
  653.  
  654.    The buffer object for the buffer that has been killed remains in
  655. existence as long as anything refers to it, but it is specially marked
  656. so that you cannot make it current or display it.  Killed buffers retain
  657. their identity, however; two distinct buffers, when killed, remain
  658. distinct according to `eq'.
  659.  
  660.    If you kill a buffer that is current or displayed in a window, XEmacs
  661. automatically selects or displays some other buffer instead.  This means
  662. that killing a buffer can in general change the current buffer.
  663. Therefore, when you kill a buffer, you should also take the precautions
  664. associated with changing the current buffer (unless you happen to know
  665. that the buffer being killed isn't current).  *Note Current Buffer::.
  666.  
  667.    If you kill a buffer that is the base buffer of one or more indirect
  668. buffers, the indirect buffers are automatically killed as well.
  669.  
  670.    The `buffer-name' of a killed buffer is `nil'.  To test whether a
  671. buffer has been killed, you can either use this feature or the function
  672. `buffer-live-p'.
  673.  
  674.  - Function: buffer-live-p BUFFER
  675.      This function returns `nil' if BUFFER is deleted, and `t'
  676.      otherwise.
  677.  
  678.  - Command: kill-buffer BUFFER-OR-NAME
  679.      This function kills the buffer BUFFER-OR-NAME, freeing all its
  680.      memory for use as space for other buffers.  (Emacs version 18 and
  681.      older was unable to return the memory to the operating system.)
  682.      It returns `nil'.
  683.  
  684.      Any processes that have this buffer as the `process-buffer' are
  685.      sent the `SIGHUP' signal, which normally causes them to terminate.
  686.      (The basic meaning of `SIGHUP' is that a dialup line has been
  687.      disconnected.)  *Note Deleting Processes::.
  688.  
  689.      If the buffer is visiting a file and contains unsaved changes,
  690.      `kill-buffer' asks the user to confirm before the buffer is killed.
  691.      It does this even if not called interactively.  To prevent the
  692.      request for confirmation, clear the modified flag before calling
  693.      `kill-buffer'.  *Note Buffer Modification::.
  694.  
  695.      Killing a buffer that is already dead has no effect.
  696.  
  697.           (kill-buffer "foo.unchanged")
  698.                => nil
  699.           (kill-buffer "foo.changed")
  700.           
  701.           ---------- Buffer: Minibuffer ----------
  702.           Buffer foo.changed modified; kill anyway? (yes or no) `yes'
  703.           ---------- Buffer: Minibuffer ----------
  704.           
  705.                => nil
  706.  
  707.  - Variable: kill-buffer-query-functions
  708.      After confirming unsaved changes, `kill-buffer' calls the functions
  709.      in the list `kill-buffer-query-functions', in order of appearance,
  710.      with no arguments.  The buffer being killed is the current buffer
  711.      when they are called.  The idea is that these functions ask for
  712.      confirmation from the user for various nonstandard reasons.  If
  713.      any of them returns `nil', `kill-buffer' spares the buffer's life.
  714.  
  715.  - Variable: kill-buffer-hook
  716.      This is a normal hook run by `kill-buffer' after asking all the
  717.      questions it is going to ask, just before actually killing the
  718.      buffer.  The buffer to be killed is current when the hook
  719.      functions run.  *Note Hooks::.
  720.  
  721.  - Variable: buffer-offer-save
  722.      This variable, if non-`nil' in a particular buffer, tells
  723.      `save-buffers-kill-emacs' and `save-some-buffers' to offer to save
  724.      that buffer, just as they offer to save file-visiting buffers.  The
  725.      variable `buffer-offer-save' automatically becomes buffer-local
  726.      when set for any reason.  *Note Buffer-Local Variables::.
  727.  
  728. 
  729. File: lispref.info,  Node: Indirect Buffers,  Prev: Killing Buffers,  Up: Buffers
  730.  
  731. Indirect Buffers
  732. ================
  733.  
  734.    An "indirect buffer" shares the text of some other buffer, which is
  735. called the "base buffer" of the indirect buffer.  In some ways it is
  736. the analogue, for buffers, of a symbolic link among files.  The base
  737. buffer may not itself be an indirect buffer.
  738.  
  739.    The text of the indirect buffer is always identical to the text of
  740. its base buffer; changes made by editing either one are visible
  741. immediately in the other.  This includes the text properties as well as
  742. the characters themselves.
  743.  
  744.    But in all other respects, the indirect buffer and its base buffer
  745. are completely separate.  They have different names, different values of
  746. point, different narrowing, different markers and overlays (though
  747. inserting or deleting text in either buffer relocates the markers and
  748. overlays for both), different major modes, and different local
  749. variables.
  750.  
  751.    An indirect buffer cannot visit a file, but its base buffer can.  If
  752. you try to save the indirect buffer, that actually works by saving the
  753. base buffer.
  754.  
  755.    Killing an indirect buffer has no effect on its base buffer.  Killing
  756. the base buffer effectively kills the indirect buffer in that it cannot
  757. ever again be the current buffer.
  758.  
  759.  - Command: make-indirect-buffer BASE-BUFFER NAME
  760.      This creates an indirect buffer named NAME whose base buffer is
  761.      BASE-BUFFER.  The argument BASE-BUFFER may be a buffer or a string.
  762.  
  763.      If BASE-BUFFER is an indirect buffer, its base buffer is used as
  764.      the base for the new buffer.
  765.  
  766.  - Function: buffer-base-buffer BUFFER
  767.      This function returns the base buffer of BUFFER.  If BUFFER is not
  768.      indirect, the value is `nil'.  Otherwise, the value is another
  769.      buffer, which is never an indirect buffer.
  770.  
  771. 
  772. File: lispref.info,  Node: Windows,  Next: Frames,  Prev: Buffers,  Up: Top
  773.  
  774. Windows
  775. *******
  776.  
  777.    This chapter describes most of the functions and variables related to
  778. Emacs windows.  See *Note Display::, for information on how text is
  779. displayed in windows.
  780.  
  781. * Menu:
  782.  
  783. * Basic Windows::          Basic information on using windows.
  784. * Splitting Windows::      Splitting one window into two windows.
  785. * Deleting Windows::       Deleting a window gives its space to other windows.
  786. * Selecting Windows::      The selected window is the one that you edit in.
  787. * Cyclic Window Ordering:: Moving around the existing windows.
  788. * Buffers and Windows::    Each window displays the contents of a buffer.
  789. * Displaying Buffers::     Higher-lever functions for displaying a buffer
  790.                              and choosing a window for it.
  791. * Choosing Window::       How to choose a window for displaying a buffer.
  792. * Window Point::           Each window has its own location of point.
  793. * Window Start::           The display-start position controls which text
  794.                              is on-screen in the window.
  795. * Vertical Scrolling::     Moving text up and down in the window.
  796. * Horizontal Scrolling::   Moving text sideways on the window.
  797. * Size of Window::         Accessing the size of a window.
  798. * Position of Window::     Accessing the position of a window.
  799. * Resizing Windows::       Changing the size of a window.
  800. * Window Configurations::  Saving and restoring the state of the screen.
  801.  
  802. 
  803. File: lispref.info,  Node: Basic Windows,  Next: Splitting Windows,  Up: Windows
  804.  
  805. Basic Concepts of Emacs Windows
  806. ===============================
  807.  
  808.    A "window" in XEmacs is the physical area of the screen in which a
  809. buffer is displayed.  The term is also used to refer to a Lisp object
  810. that represents that screen area in Emacs Lisp.  It should be clear
  811. from the context which is meant.
  812.  
  813.    XEmacs groups windows into frames.  A frame represents an area of
  814. screen available for XEmacs to use.  Each frame always contains at least
  815. one window, but you can subdivide it vertically or horizontally into
  816. multiple nonoverlapping Emacs windows.
  817.  
  818.    In each frame, at any time, one and only one window is designated as
  819. "selected within the frame".  The frame's cursor appears in that
  820. window.  At ant time, one frame is the selected frame; and the window
  821. selected within that frame is "the selected window".  The selected
  822. window's buffer is usually the current buffer (except when `set-buffer'
  823. has been used).  *Note Current Buffer::.
  824.  
  825.    For practical purposes, a window exists only while it is displayed in
  826. a frame.  Once removed from the frame, the window is effectively deleted
  827. and should not be used, *even though there may still be references to
  828. it* from other Lisp objects.  Restoring a saved window configuration is
  829. the only way for a window no longer on the screen to come back to life.
  830. (*Note Deleting Windows::.)
  831.  
  832.    Each window has the following attributes:
  833.  
  834.    * containing frame
  835.  
  836.    * window height
  837.  
  838.    * window width
  839.  
  840.    * window edges with respect to the frame or screen
  841.  
  842.    * the buffer it displays
  843.  
  844.    * position within the buffer at the upper left of the window
  845.  
  846.    * amount of horizontal scrolling, in columns
  847.  
  848.    * point
  849.  
  850.    * the mark
  851.  
  852.    * how recently the window was selected
  853.  
  854.    Users create multiple windows so they can look at several buffers at
  855. once.  Lisp libraries use multiple windows for a variety of reasons, but
  856. most often to display related information.  In Rmail, for example, you
  857. can move through a summary buffer in one window while the other window
  858. shows messages one at a time as they are reached.
  859.  
  860.    The meaning of "window" in XEmacs is similar to what it means in the
  861. context of general-purpose window systems such as X, but not identical.
  862. The X Window System places X windows on the screen; XEmacs uses one or
  863. more X windows as frames, and subdivides them into Emacs windows.  When
  864. you use XEmacs on a character-only terminal, XEmacs treats the whole
  865. terminal screen as one frame.
  866.  
  867.    Most window systems support arbitrarily located overlapping windows.
  868. In contrast, Emacs windows are "tiled"; they never overlap, and
  869. together they fill the whole screen or frame.  Because of the way in
  870. which XEmacs creates new windows and resizes them, you can't create
  871. every conceivable tiling of windows on an Emacs frame.  *Note Splitting
  872. Windows::, and *Note Size of Window::.
  873.  
  874.    *Note Display::, for information on how the contents of the window's
  875. buffer are displayed in the window.
  876.  
  877.  - Function: windowp OBJECT
  878.      This function returns `t' if OBJECT is a window.
  879.  
  880. 
  881. File: lispref.info,  Node: Splitting Windows,  Next: Deleting Windows,  Prev: Basic Windows,  Up: Windows
  882.  
  883. Splitting Windows
  884. =================
  885.  
  886.    The functions described here are the primitives used to split a
  887. window into two windows.  Two higher level functions sometimes split a
  888. window, but not always: `pop-to-buffer' and `display-buffer' (*note
  889. Displaying Buffers::.).
  890.  
  891.    The functions described here do not accept a buffer as an argument.
  892. The two "halves" of the split window initially display the same buffer
  893. previously visible in the window that was split.
  894.  
  895.  - Function: one-window-p &optional NO-MINI ALL-FRAMES
  896.      This function returns non-`nil' if there is only one window.  The
  897.      argument NO-MINI, if non-`nil', means don't count the minibuffer
  898.      even if it is active; otherwise, the minibuffer window is
  899.      included, if active, in the total number of windows which is
  900.      compared against one.
  901.  
  902.      The argument ALL-FRAME controls which set of windows are counted.
  903.         * If it is `nil' or omitted, then count only the selected
  904.           frame, plus the minibuffer it uses (which may be on another
  905.           frame).
  906.  
  907.         * If it is `t', then windows on all frames that currently exist
  908.           (including invisible and iconified frames) are counted.
  909.  
  910.         * If it is the symbol `visible', then windows on all visible
  911.           frames are counted.
  912.  
  913.         * If it is the number 0, then windows on all visible and
  914.           iconified frames are counted.
  915.  
  916.         * If it is any other value, then precisely the windows in
  917.           WINDOW's frame are counted, excluding the minibuffer in use
  918.           if it lies in some other frame.
  919.  
  920.  - Command: split-window &optional WINDOW SIZE HORIZONTAL
  921.      This function splits WINDOW into two windows.  The original window
  922.      WINDOW remains the selected window, but occupies only part of its
  923.      former screen area.  The rest is occupied by a newly created
  924.      window which is returned as the value of this function.
  925.  
  926.      If HORIZONTAL is non-`nil', then WINDOW splits into two side by
  927.      side windows.  The original window WINDOW keeps the leftmost SIZE
  928.      columns, and gives the rest of the columns to the new window.
  929.      Otherwise, it splits into windows one above the other, and WINDOW
  930.      keeps the upper SIZE lines and gives the rest of the lines to the
  931.      new window.  The original window is therefore the left-hand or
  932.      upper of the two, and the new window is the right-hand or lower.
  933.  
  934.      If WINDOW is omitted or `nil', then the selected window is split.
  935.      If SIZE is omitted or `nil', then WINDOW is divided evenly into
  936.      two parts.  (If there is an odd line, it is allocated to the new
  937.      window.)  When `split-window' is called interactively, all its
  938.      arguments are `nil'.
  939.  
  940.      The following example starts with one window on a frame that is 50
  941.      lines high by 80 columns wide; then the window is split.
  942.  
  943.           (setq w (selected-window))
  944.                => #<window 8 on windows.texi>
  945.           (window-edges)          ; Edges in order:
  946.                => (0 0 80 50)     ;   left--top--right--bottom
  947.  
  948.           ;; Returns window created
  949.           (setq w2 (split-window w 15))
  950.                => #<window 28 on windows.texi>
  951.  
  952.           (window-edges w2)
  953.                => (0 15 80 50)    ; Bottom window;
  954.                                   ;   top is line 15
  955.  
  956.           (window-edges w)
  957.                => (0 0 80 15)     ; Top window
  958.  
  959.      The frame looks like this:
  960.  
  961.           __________
  962.                   |          |  line 0
  963.                   |    w     |
  964.                   |__________|
  965.                   |          |  line 15
  966.                   |    w2    |
  967.                   |__________|
  968.                                 line 50
  969.            column 0   column 80
  970.  
  971.      Next, the top window is split horizontally:
  972.  
  973.           (setq w3 (split-window w 35 t))
  974.                => #<window 32 on windows.texi>
  975.  
  976.           (window-edges w3)
  977.                => (35 0 80 15)  ; Left edge at column 35
  978.  
  979.           (window-edges w)
  980.                => (0 0 35 15)   ; Right edge at column 35
  981.  
  982.           (window-edges w2)
  983.                => (0 15 80 50)  ; Bottom window unchanged
  984.  
  985.      Now, the screen looks like this:
  986.  
  987.           column 35
  988.                    __________
  989.                   |   |      |  line 0
  990.                   | w |  w3  |
  991.                   |___|______|
  992.                   |          |  line 15
  993.                   |    w2    |
  994.                   |__________|
  995.                                 line 50
  996.            column 0   column 80
  997.  
  998.      Normally, Emacs indicates the border between two side-by-side
  999.      windows with a scroll bar (*note Scroll Bars: X Frame Parameters.)
  1000.      or `|' characters.  The display table can specify alternative
  1001.      border characters; see *Note Display Tables::.
  1002.  
  1003.  - Command: split-window-vertically &optional SIZE
  1004.      This function splits the selected window into two windows, one
  1005.      above the other, leaving the selected window with SIZE lines.
  1006.  
  1007.      This function is simply an interface to `split-windows'.  Here is
  1008.      the complete function definition for it:
  1009.  
  1010.           (defun split-window-vertically (&optional arg)
  1011.             "Split current window into two windows, one above the other."
  1012.             (interactive "P")
  1013.             (split-window nil (and arg (prefix-numeric-value arg))))
  1014.  
  1015.  - Command: split-window-horizontally &optional SIZE
  1016.      This function splits the selected window into two windows
  1017.      side-by-side, leaving the selected window with SIZE columns.
  1018.  
  1019.      This function is simply an interface to `split-windows'.  Here is
  1020.      the complete definition for `split-window-horizontally' (except for
  1021.      part of the documentation string):
  1022.  
  1023.           (defun split-window-horizontally (&optional arg)
  1024.             "Split selected window into two windows, side by side..."
  1025.             (interactive "P")
  1026.             (split-window nil (and arg (prefix-numeric-value arg)) t))
  1027.  
  1028.  - Function: one-window-p &optional NO-MINI ALL-FRAMES
  1029.      This function returns non-`nil' if there is only one window.  The
  1030.      argument NO-MINI, if non-`nil', means don't count the minibuffer
  1031.      even if it is active; otherwise, the minibuffer window is
  1032.      included, if active, in the total number of windows, which is
  1033.      compared against one.
  1034.  
  1035.      The argument ALL-FRAMES specifies which frames to consider.  Here
  1036.      are the possible values and their meanings:
  1037.  
  1038.     `nil'
  1039.           Count the windows in the selected frame, plus the minibuffer
  1040.           used by that frame even if it lies in some other frame.
  1041.  
  1042.     `t'
  1043.           Count all windows in all existing frames.
  1044.  
  1045.     `visible'
  1046.           Count all windows in all visible frames.
  1047.  
  1048.     0
  1049.           Count all windows in all visible or iconified frames.
  1050.  
  1051.     anything else
  1052.           Count precisely the windows in the selected frame, and no
  1053.           others.
  1054.  
  1055. 
  1056. File: lispref.info,  Node: Deleting Windows,  Next: Selecting Windows,  Prev: Splitting Windows,  Up: Windows
  1057.  
  1058. Deleting Windows
  1059. ================
  1060.  
  1061.    A window remains visible on its frame unless you "delete" it by
  1062. calling certain functions that delete windows.  A deleted window cannot
  1063. appear on the screen, but continues to exist as a Lisp object until
  1064. there are no references to it.  There is no way to cancel the deletion
  1065. of a window aside from restoring a saved window configuration (*note
  1066. Window Configurations::.).  Restoring a window configuration also
  1067. deletes any windows that aren't part of that configuration.
  1068.  
  1069.    When you delete a window, the space it took up is given to one
  1070. adjacent sibling.  (In Emacs version 18, the space was divided evenly
  1071. among all the siblings.)
  1072.  
  1073.  - Function: window-live-p WINDOW
  1074.      This function returns `nil' if WINDOW is deleted, and `t'
  1075.      otherwise.
  1076.  
  1077.      *Warning:* Erroneous information or fatal errors may result from
  1078.      using a deleted window as if it were live.
  1079.  
  1080.  - Command: delete-window &optional WINDOW
  1081.      This function removes WINDOW from the display.  If WINDOW is
  1082.      omitted, then the selected window is deleted.  An error is signaled
  1083.      if there is only one window when `delete-window' is called.
  1084.  
  1085.      This function returns `nil'.
  1086.  
  1087.      When `delete-window' is called interactively, WINDOW defaults to
  1088.      the selected window.
  1089.  
  1090.  - Command: delete-other-windows &optional WINDOW
  1091.      This function makes WINDOW the only window on its frame, by
  1092.      deleting the other windows in that frame.  If WINDOW is omitted or
  1093.      `nil', then the selected window is used by default.
  1094.  
  1095.      The result is `nil'.
  1096.  
  1097.  - Command: delete-windows-on BUFFER &optional FRAME
  1098.      This function deletes all windows showing BUFFER.  If there are no
  1099.      windows showing BUFFER, it does nothing.
  1100.  
  1101.      `delete-windows-on' operates frame by frame.  If a frame has
  1102.      several windows showing different buffers, then those showing
  1103.      BUFFER are removed, and the others expand to fill the space.  If
  1104.      all windows in some frame are showing BUFFER (including the case
  1105.      where there is only one window), then the frame reverts to having a
  1106.      single window showing another buffer chosen with `other-buffer'.
  1107.      *Note The Buffer List::.
  1108.  
  1109.      The argument FRAME controls which frames to operate on:
  1110.  
  1111.         * If it is `nil', operate on the selected frame.
  1112.  
  1113.         * If it is `t', operate on all frames.
  1114.  
  1115.         * If it is `visible', operate on all visible frames.
  1116.  
  1117.         * 0 If it is 0, operate on all visible or iconified frames.
  1118.  
  1119.         * If it is a frame, operate on that frame.
  1120.  
  1121.      This function always returns `nil'.
  1122.  
  1123. 
  1124. File: lispref.info,  Node: Selecting Windows,  Next: Cyclic Window Ordering,  Prev: Deleting Windows,  Up: Windows
  1125.  
  1126. Selecting Windows
  1127. =================
  1128.  
  1129.    When a window is selected, the buffer in the window becomes the
  1130. current buffer, and the cursor will appear in it.
  1131.  
  1132.  - Function: selected-window &optional DEVICE
  1133.      This function returns the selected window.  This is the window in
  1134.      which the cursor appears and to which many commands apply.  Each
  1135.      separate device can have its own selected window, which is
  1136.      remembered as focus changes from device to device.  Optional
  1137.      argument DEVICE specifies which device to return the selected
  1138.      window for, and defaults to the selected device.
  1139.  
  1140.  - Function: select-window WINDOW
  1141.      This function makes WINDOW the selected window.  The cursor then
  1142.      appears in WINDOW (on redisplay).  The buffer being displayed in
  1143.      WINDOW is immediately designated the current buffer.
  1144.  
  1145.      The return value is WINDOW.
  1146.  
  1147.           (setq w (next-window))
  1148.           (select-window w)
  1149.                => #<window 65 on windows.texi>
  1150.  
  1151.  - Macro: save-selected-window FORMS...
  1152.      This macro records the selected window, executes FORMS in
  1153.      sequence, then restores the earlier selected window.  It does not
  1154.      save or restore anything about the sizes, arrangement or contents
  1155.      of windows; therefore, if the FORMS change them, the changes are
  1156.      permanent.
  1157.  
  1158.    The following functions choose one of the windows on the screen,
  1159. offering various criteria for the choice.
  1160.  
  1161.  - Function: get-lru-window &optional FRAME
  1162.      This function returns the window least recently "used" (that is,
  1163.      selected).  The selected window is always the most recently used
  1164.      window.
  1165.  
  1166.      The selected window can be the least recently used window if it is
  1167.      the only window.  A newly created window becomes the least
  1168.      recently used window until it is selected.  A minibuffer window is
  1169.      never a candidate.
  1170.  
  1171.      The argument FRAME controls which windows are considered.
  1172.  
  1173.         * If it is `nil', consider windows on the selected frame.
  1174.  
  1175.         * If it is `t', consider windows on all frames.
  1176.  
  1177.         * If it is `visible', consider windows on all visible frames.
  1178.  
  1179.         * If it is 0, consider windows on all visible or iconified
  1180.           frames.
  1181.  
  1182.         * If it is a frame, consider windows on that frame.
  1183.  
  1184.  - Function: get-largest-window &optional FRAME
  1185.      This function returns the window with the largest area (height
  1186.      times width).  If there are no side-by-side windows, then this is
  1187.      the window with the most lines.  A minibuffer window is never a
  1188.      candidate.
  1189.  
  1190.      If there are two windows of the same size, then the function
  1191.      returns the window that is first in the cyclic ordering of windows
  1192.      (see following section), starting from the selected window.
  1193.  
  1194.      The argument FRAME controls which set of windows are considered.
  1195.      See `get-lru-window', above.
  1196.  
  1197.